<!doctype html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  <title>通话记录</title>
  <link rel="stylesheet" type="text/css" href="../css/api.css" />
  <link rel="stylesheet" type="text/css" href="../css/nearby.css" />
  <style>
    #header{position: fixed;width: 100%;top: 0}
    .wrap{margin-top:75px}
  </style>
</head>

<body>
  <div id="app" v-cloak>
    <header id="header">
      <div class="header-wrap border-bottom">
        <div class="header-left" tapmode onclick="api.closeWin();">
          <i class="iconfont icon-pre"></i>
        </div>
        <div class="header-title">通话记录</div>
      </div>
    </header>

    <div class="wrap flex-wrap flex-vertical">
      <div class="flex-con">
        <div v-if="list.length > 0" class="list-wrap">
          <div @click="openDetail(item.member_id)" v-for="(item, i) in list" :key="item.id" class="list-item">
            <div class="avatar">
              <img :src="item.avatar" alt="">
            </div>
            <div class="info-wrap">
              <div class="name">{{item.name}}
                <span :class="['age'+ item.sex]">
                  <i :class="['icon-sex' + item.sex, 'iconfont']"></i>
                </span>
              </div>
            </div>
            <i class="iconfont icon-next"></i>
          </div>
        </div>
        <div v-else class="empty-wrap">
          <image class="empty-img" src="../image/empty.png"></image>
          <div class="empty-text">😔暂无通话记录</div>
        </div>
      </div>
    </div>
  </div>
</body>

</html>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/vue.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript">
  var app;
  apiready = function () {
    $api.fixStatusBar($api.dom('#header'));
    api.setStatusBarStyle({
      style: 'light',
    });
    app = new Vue({
      el: '#app',
      data: {
        list: [],
      },
      created: function () {},
      mounted: function () {
        this.getCallList();
      },
      methods: {
        openDetail: function (id) {
          api.openWin({
            name: 'user_home',
            url: 'user_home.html',
            slidBackEnabled: false,
            pageParam: {
              member_id: id
            }
          });
        },

        getCallList: function () {
          var _this = this;
          api.ajax({
            url: baseUrl + 'message/callList',
            method: 'get',
            headers: {
              token: $api.getStorage('deviceToken')
            },
            data: {
              values: {
                uid: $api.getStorage('uid'),
              },
            }
          }, function (ret, err) {
            if (ret.status == '200') {
              _this.list = ret.data;
            }
          })
        }
      },
    })
  }
</script>